/*
	Name: 	team_management.lua
	Side:	SHARED
	
	Role: 	
	
	NOTES:	Coco: I'm reconsidering if this file is actually useful, gonna wait and see
				  for now i'm just leaving it here.
*/
if ZS == nil then
	
	error( "\"team_management.lua\" Could not load because 'ZS' was not initialised!" )
	return
end

ZS.teams = {}

--[[---------------------------------------------------------------------------
	Name: ZS.SetupTeam
	Desc: Initialises a new team
--]]---------------------------------------------------------------------------
function ZS.SetupTeam( teamid, title, colour, enabled )

	team.SetUp( teamid, title, colour, enabled )
	
	ZS.teams[teamid] = { 
						title = title, 
						colour = colour, 
						enabled = enabled,
						}
end

--[[---------------------------------------------------------------------------
	Name: ZS.SetTeamEnabled
	Desc: Sets whether or not the team can be joined by players
--]]---------------------------------------------------------------------------
function ZS.SetTeamEnabled( teamid, bEnabled )

	local team = ZS.teams[ teamid ]
	
	if team == nil then
		Msg( "Warning from 'ZS.SetTeamEnabled': No team exists with id("..teamid..")." )
	else
		team.enabled = bEnabled or true
	end
end
	
	

--[[---------------------------------------------------------------------------
	Name: ZS.CanPlayerJoinTeam
	Desc: returns whether or not a player should be able to join a given team
--]]---------------------------------------------------------------------------
function ZS.CanPlayerJoinTeam( ply, teamid )
	
	local team = ZS.teams[ teamid ]
	
	if team == nil then
		Msg( "Warning from 'ZS.CanPlayerJoinTeam': No team exists with id("..teamid..")." )
		return false
	end
	
	return team.enabled
end

